const UdpServer=require("./UdpServer.js");
const WebSocketServer=require("./WebSocketServer.js");
udpApp=new UdpServer();
udpApp.listen(15000)
wsApp=new WebSocketServer()
wsApp.listen(15001)
wsApp.set("connection",(req,res)=>{
    console.log("connect"+ req.remoteIp,req.remotePort)
});
wsApp.set("close",(req,res)=>{
    console.log("close"+ req.remoteIp,req.remotePort)
});
wsApp.set("message",(req,res)=>{
    let s="ws<=: ";
    req.params.forEach(u=>s=s+u.toString(16).padStart(2,0)+" ");
    console.log(s);
    udpApp.send(req.params)
});
udpApp.set("message", (req,res)=>{
    let s="udp<=: ";
    req.params.forEach(u=>s=s+u.toString(16).padStart(2,0)+" ");
    console.log(s);
    wsApp.send(req.params)
})
